  { CDROMWIN.INS - CD-ROM Installation File - Windows-platform          }

  InstName := 'Express Software';
  Cls;
  StrRet := InstName;
  DoFunc(0);

GetFrom:
  DoFunc(5);
  Mssg(6,3,'Enter the Drive letter of your CD-ROM drive.');
  DoFunc(11);
  DoFunc(2);
  CDROMDrive := StrRet;
  BranchEq(IntRet,0,Leaving);
  BranchEq(IntRet,2,GetFrom);

GetDrive:
  DoFunc(5);
  Mssg(6,3,'Enter the Drive letter of your harddisk.');
  StrRet := 'C';
  DoFunc(2);
  ToDrive := StrRet;
  BranchEq(IntRet,0,Leaving);
  BranchEq(IntRet,2,GetDrive);

  { Example of the directory name on their hard disk }
  {  Should be the same as the directory name stored }
  {  in the HRWCD.CDB file                           }
  ConCat(SysPath,ToDrive,':\EXPGRAPH');

  {Make SysPath2 contain the full path to the Batch file on their harddisk}
  StrRet := SysPath;
  DoFunc(6);
  SysPath2 := StrRet;
  ConCat(SysPath2,'START.BAT');

  DoFunc(5);
  Mssg(6,3,'You have specified the following:');
  a := '';
  Concat(Uaf,'- CD-ROM is in Drive ',CDROMDrive,':');
  Mssg(6,5,a);
  a := '';
  Concat(a,'- Install Batch File onto Drive ',SysPath);
  Mssg(6,6,a);
  DoFunc(7);
  DoFunc(5);
  BranchEq(IntRet,0,Leaving);
  BranchEq(IntRet,2,GetFrom);

  {Check if they have (IntRet*2+100) Kilobytes available on their harddisk}
  IntRet := 1;
  DoFunc(4);
  BranchEq(IntRet,0,Leaving);
  BranchEq(IntRet,2,Leaving);

  DoFunc(5);
  Mssg(6,3,'Installing CD-ROM start up batch file now:');

  {Make The Directories Here}
  Mssg(5,21,'Creating Directory...');
  ChDir(CDROMDrive,':');
  ChDir('\HR');       {built in directory name on the CD}
  ChDir(ToDrive,':');
  MkDir(SysPath);
  ChDir(SysPath);

  Mssg(5,21,'Creating Batch File...');
  StrRet := SysPath2;
  IntRet := CDROMDrive;
  DoFunc(10);

  Mssg(5,21,'Creating Program Manager Group...');
  { Creates a Program Manager group, if one doesn't already exist, and }
  { makes that group the top Program Manager Group                     }
  StrRet := 'Express Software - Graphics #1';
  DoFunc(16);
  BranchEq(IntRet,0,Complete);

  { Now create an icon and put it in the top Program Manager Group     }
  { Again the '\HR' in the below example is the built-in directory on  }
  { the CD and the 'filename.HW4' can either be replaced with your     }
  { filename or removed.                                               }
  { The second line contains a comma and the name of the item.         }
  StrRet := CDROMDrive;
  Concat(StrRet,':\HR\HRWCD.EXE EXPGRAPH.HW4');
  Concat(StrRet,',','Express Software - Graphics #1');
  DoFunc(17);
  
  {            Only use the section below if you are want              }
  {     to allow the installation process to modify the INI file       }

  { A good reason to modify the Initialization file is to give it the  }
  { names of directories where files will be stored                    }
  { For instance if pictures are stored in the directory \PCX on the   }
  { CD, then the only way for HyperWriter to know this intially is by  }
  { having the directory in the INI file.  Since an INI file cannot    }
  { accept a directory without a drive letter and the drive letter of  }
  { the CD-ROM drive won't be known until install time, the process    }
  { below allows you to set this information                           }

  { Note again that '\HR' is the built-in directory name on the CD.    }

  Copy(CDROMDrive,':\HR\HRWCD.INI');
  DoFunc(22);
  Mssg(5,21,'Modifying Initialization File...');

  { The reason for copying the .INI file from the CD first, is that    }
  { this allows any other INI settings to be preset when you press the }
  { CD.                                                                }

  { Make StrRet contain the complete path the .INI file                }
  StrRet := SysPath;
  DoFunc(6);
  ConCat(StrRet,'HRWCD.INI');

  { Make sure the file is available for Writing.                       }
  { In most cases when copying a file from a CD, the file will be      }
  { read-only.  Warning don't include this if you don't first copy the }
  { file from the CD, because the file won't exist and DoFunc(23) will }
  { return an error.                                                   }
  IntRet := 0;
  DoFunc(23);
  BranchEq(IntRet,0,DoOpen);
  Goto Error;

DoOpen:
  { Open the file (or create one if one didn't exist) }
  DoFunc(18);
  BranchEq(IntRet,0,INIOpen);
  Goto Error;

INIOpen:
  { Create the entry for the INI using variables at your disposal      }
  StrRet := 'Pictures Path = ';
  Concat(StrRet,CDROMDrive,':\PICTURES');
  { Write the entry out to the .INI file                               }
  DoFunc(19);
  BranchEq(IntRet,0,WroteINI);
  Goto Error;

WroteINI:
  { Close the file }
  DoFunc(20);
  BranchEq(IntRet,0,INIClose);
  Goto Error;

INIClose:
  { Any other processing would normally go here, but in our case we're }
  { done.                                                              }

Complete:
  StrRet := InstName;
  DoFunc(0);
  Mssg(0,0,'Installation Complete');
  Cls;
  Goto Exit;

Error:
  StrRet := InstName;
  DoFunc(0);
  Mssg(0,0,'An error has occurred during the installation process.');
  Cls;
  Goto Exit;

Leaving:
  StrRet := InstName;
  DoFunc(0);
  Mssg(0,0,'Installation aborted by User');
  Cls;
  Goto Exit;

Exit:

